@push('title')
    <title>恒博携程规则运价政策</title>
@endpush
@push("style2")
    <style>

        form .split-text{
            float: left;
            line-height: 50px;
            font-size: 15px;
            font-weight: 700;
            text-align: left;
            position: absolute;
            left: 40px;
            color: #757575;
            margin-top: -13px
        }
        .layui-form-item {
            margin-left: 300px;
            margin-bottom: 10px;
        }
        .layui-form-label {
            width: 120px;
        }
        /* 底部边框 */
        .input-bottom {
            border: none;
            border-bottom: 1px dashed #e6e6e6;
            outline: none;
            color: #9d9d9d;
            background: none;
        }

        input[disabled] {
            background-color: transparent;
            color: inherit; /* 保持文字颜色不变 */
            cursor: not-allowed; /* 设置鼠标指针为禁止点击状态 */
        }

        .layui-form-mid {
            color: #9d9d9d;
        }
        .layui-textarea,.layui-input {

            border-radius: 4px !important;
            height: 34px;
        }
        .piece {

            margin-top: 15px;
            margin-bottom: 15px;
        }

        .pata-item {
            display: @if($policy['BasicUnit']['NeedPata'] == 'T') block @else none @endif;
        }

        .back-item{
            display:  @if($policy['FlightUnit']['BackFlight']) block @else none @endif ;
        }

        .flight {
            background: none;
            color: #1976d2;
            border: solid 1px #1976d2;
            height: 30px;
            line-height: 30px;
            padding: 0 15px;
        }

        a.flight:hover {
            color: #1976d2;
            background-color: rgba(25,118,210,0.1);
        }

    </style>
@endpush
@extends('layout.layer')
@section('content')

    <form class="layui-form" action="#" lay-filter="first">
        <input type="hidden" name="_token" value="{{csrf_token()}}">
        <input type="hidden" name="platform" value="20">
        <input type="hidden" name="id" value="{{$id}}">
        <hr>
        <div class="split-text">基本信息</div>
        <div class="piece">
            <div class="layui-form-item">
                <label class="layui-form-label">政策ID(自动生成)</label>
                <div class="layui-input-inline">
                    <input type="text" name="PolicyID" value="{{$policy['PolicyID']}}" lay-verify="" lay-reqText="政策ID" placeholder="政策ID" autocomplete="off" class="layui-input layui-disabled" >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">产品类型</label>
                <div class="layui-input-inline">
                    <select name="ProductType">
                        <option value="0" @if($policy['BasicUnit']['ProductType'] == 0) selected @endif>行程单产品</option>
                        <option value="1" @if($policy['BasicUnit']['ProductType'] == 1) selected @endif>无全额行程单产品</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">订位</label>
                <div class="layui-input-block">
                    <input type="radio" name="IsBooking" value="T" title="全部订位" @if($policy['BasicUnit']['IsBooking'] == 'T') checked @endif lay-filter="IsBooking">
                    <input type="radio" name="IsBooking" value="F" title="全部不订位" @if($policy['BasicUnit']['IsBooking'] == 'F') checked @endif  lay-filter="IsBooking">
                    <input type="radio" name="IsBooking" value="" @if($policy['BasicUnit']['IsBooking'] == 'T' && $policy['BasicUnit']['BookingThreshold'] > 0) checked @endif title="紧张订位" lay-filter="IsBooking">
                </div>
            </div>

            <div class="layui-form-item" id="BookingThreshold" style="display: none;">
                <label class="layui-form-label">紧张阈值</label>
                <div class="layui-input-inline">
                    <input type="text" name="BookingThreshold" value="{{$policy['BasicUnit']['BookingThreshold']}}" lay-verify="" lay-reqText="" required placeholder="" autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid">外放舱位数量小于等于阈值时订位,范围在1-9</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">是否紧张位置过滤</label>
                <div class="layui-input-block">
                    <input type="radio" name="IsShortageFilter" value="T" title="是" @if($policy['BasicUnit']['IsShortageFilter'] == 'T') checked @endif lay-filter="IsShortageFilter">
                    <input type="radio" name="IsShortageFilter" value="F" title="否" @if($policy['BasicUnit']['IsShortageFilter'] == 'F') checked @endif  lay-filter="IsShortageFilter">
                </div>
            </div>

            <div class="layui-form-item" id="ShortageFilterCount" style="display: none;">
                <label class="layui-form-label">紧张过滤阈值</label>
                <div class="layui-input-inline">
                    <input type="text" name="ShortageFilterCount" value="{{$policy['BasicUnit']['ShortageFilterCount']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid">外放舱位数小于紧张过滤阈值时，将过滤该政策</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">授权office号</label>
                <div class="layui-input-inline" lay-filter="OfficeNo">
                    <select name="OfficeNo">
                        <option value="" ></option>
                        <option value="CGO134" @if($policy['BasicUnit']['OfficeNo'] == 'CGO134') selected @endif >CGO134</option>
                        <option value="SHA717" @if($policy['BasicUnit']['OfficeNo'] == 'SHA717') selected @endif >SHA717</option>
                    </select>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">PATA</label>
                <div class="layui-input-block">
                    <input type="radio" name="NeedPata" value="T" title="是" @if($policy['BasicUnit']['NeedPata'] == 'T') checked @endif lay-filter="NeedPATA">
                    <input type="radio" name="NeedPata" value="F" title="否" @if($policy['BasicUnit']['NeedPata'] == 'F') checked @endif lay-filter="NeedPATA">
                </div>
            </div>

            <div class="layui-form-item pata-item">
                <label class="layui-form-label">上浮</label>
                <div class="layui-input-inline">
                    <input type="text" name="UpFloatPrice" value="{{$policy['BasicUnit']['UpFloatPrice']}}" lay-verify="" lay-reqText="" placeholder="非负整数" autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid">请填写非负整数，单位元,不填默认落10，表示上浮10元</div>
            </div>

            <div class="layui-form-item pata-item">
                <label class="layui-form-label">下浮</label>
                <div class="layui-input-inline">
                    <input type="text" name="DownFloatPrice" value="{{$policy['BasicUnit']['DownFloatPrice']}}" lay-verify="" lay-reqText="" placeholder="非负整数" autocomplete="off" class="layui-input" >
                </div>
                <div class="layui-form-mid">请填写非负整数，单位元,不填默认落10000，表示下浮不限</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">政策代码</label>
                <div class="layui-input-inline">
                    <input type="text" name="PolicyCode" value="{{$policy['BasicUnit']['PolicyCode']}}" lay-verify="" lay-reqText=""  placeholder="" autocomplete="off" class="layui-input" >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">大客户编码</label>
                <div class="layui-input-inline">
                    <input type="text" name="VipCode" value="{{$policy['BasicUnit']['VipCode']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input" >
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label layui-required">政策有效性</label>
                <div class="layui-input-block">
                    <input type="radio" name="PolicyStatus" value="NORMAL" @if($policy['BasicUnit']['PolicyStatus'] == 'NORMAL') checked @endif title="有效">
                    <input type="radio" name="PolicyStatus" value="INVALID" @if($policy['BasicUnit']['PolicyStatus'] == 'INVALID') checked @endif title="无效">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">支持共享航班</label>
                <div class="layui-input-block">
                    <input type="radio" name="IsShareFlight" value="T" title="是" @if($policy['BasicUnit']['IsShareFilght'] == 'T') checked @endif lay-filter="IsShareFlight">
                    <input type="radio" name="IsShareFlight" value="F" title="否" @if($policy['BasicUnit']['IsShareFilght'] == 'F') checked @endif lay-filter="IsShareFlight">
                </div>
            </div>

            <div class="layui-form-item" id="IsValidCarrierAirline" style="display: none">
                <label class="layui-form-label">按照承运航司验舱验价</label>
                <div class="layui-input-block">
                    <input type="radio" name="IsValidCarrierAirline" value="T" title="是" @if($policy['BasicUnit']['IsValidCarrierAirline'] == 'T') checked @endif lay-filter="IsValidCarrierAirline">
                    <input type="radio" name="IsValidCarrierAirline" value="F" title="否" @if($policy['BasicUnit']['IsValidCarrierAirline'] == 'F') checked @endif lay-filter="IsValidCarrierAirline">
                </div>
            </div>

            <div class="layui-form-item" id="CarrierAirlines" style="display: none">
                <label class="layui-form-label">实际承运航司</label>
                <div class="layui-input-inline">
                    <input type="text" name="CarrierAirlines" value="{{$policy['BasicUnit']['CarrierAirlines']}}" lay-verify="" lay-reqText="" placeholder="实际承运航司二字码,多个用,分隔" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">出票备注</label>
                <div class="layui-input-inline" style="width: 405px">
                    <input type="text" name="TicketRemark" value="{{$policy['BasicUnit']['TicketRemark']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid" >PATA特殊指令不为空时，出票备注必填</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">IATA号</label>
                <div class="layui-input-inline">
                    <input type="text" name="IATANo" value="" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                </div>
            </div>
        </div>
        <hr>
        <div class="split-text">航班信息</div>
        <div class="piece">
            <div class="layui-form-item">
                <label class="layui-form-label">航程类型</label>
                <div class="layui-input-block">
                    <input type="radio" name="FlightWay" value="S" title="单程" checked lay-filter="FlightWay">
                    <input type="radio" name="FlightWay" value="D" title="往返" lay-filter="FlightWay">
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label layui-required">航空公司</label>
                <div class="layui-input-inline">
                    <input type="text" name="AirLine" value="MF" lay-verify="required|title" lay-reqText="" placeholder="二字码" autocomplete="off" class="layui-input">
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-inline">
                    <label class="layui-form-label layui-required">航班</label>
                    <div class="layui-input-inline">
                        <a class="layui-btn flight" id="SaleFlightBtn">+ 添加可售范围</a><br>
                    </div>
                </div>

                <script type="text/html" id="SaleFlightHtml">
                    <div class="layui-inline" >
                        <input type="hidden" name="{saleFlight}[{index}][IsCanSale]" value="{IsCanSale}" placeholder="" class="layui-input">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <input type="text" name="{saleFlight}[{index}][DPort]" value="" placeholder="起飞机场" class="layui-input">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" name="{saleFlight}[{index}][APort]" value="" placeholder="降落机场" class="layui-input">
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="{saleFlight}[{index}][FlightFrom]" value="" placeholder="起始航班号" class="layui-input">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline">
                            <input type="text" name="{saleFlight}[{index}][FlightTo]" value="" placeholder="截止航班号" class="layui-input">
                        </div>
                        <div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-delete FlightSaleDelete"></i></div>
                    </div>
                </script>
                <div class="layui-inline" id="FlightSale">

                    @if(!empty($policy['FlightUnit']['GoFlight']))
                        @if(!empty($policy['FlightUnit']['GoFlight']['SaleFlightList']))
                            @foreach($policy['FlightUnit']['GoFlight']['SaleFlightList'] as $key=>$value)
                                @if($value['IsCanSale'] == 'T')
                                    <div class="layui-inline" >
                                        <input type="hidden" name="SaleFlightList[{{$key}}][IsCanSale]" value="{{$value['IsCanSale']}}" placeholder="" class="layui-input">
                                        <label class="layui-form-label"></label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][DPort]" value="{{$value['DPort']}}" placeholder="起飞机场" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">-</div>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][APort]" value="{{$value['Aport']}}" placeholder="降落机场" class="layui-input">
                                        </div>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][FlightFrom]" value="{{substr($value['FlightFrom'],2,4)}}" placeholder="起始航班号" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">-</div>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][FlightTo]" value="{{substr($value['FlightTo'],2,4)}}" placeholder="截止航班号" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-delete FlightSaleDelete"></i></div>
                                    </div>
                                @endif
                            @endforeach
                        @endif
                    @endif
                </div>
                <br>
                <div class="layui-inline">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-inline">
                        <a class="layui-btn flight" id="SaleLimitBtn">+ 添加禁售范围</a><br>
                    </div>
                </div>
                <div class="layui-inline" id="SaleLimit">

                    @if(!empty($policy['FlightUnit']['GoFlight']))
                        @if(!empty($policy['FlightUnit']['GoFlight']['SaleFlightList']))
                            @foreach($policy['FlightUnit']['GoFlight']['SaleFlightList'] as $key=>$value)
                                @if($value['IsCanSale'] == 'F')
                                    <div class="layui-inline" >
                                        <input type="hidden" name="SaleFlightList[{{$key}}][IsCanSale]" value="{{$value['IsCanSale']}}" placeholder="" class="layui-input">
                                        <label class="layui-form-label"></label>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][DPort]" value="{{$value['DPort']}}" placeholder="起飞机场" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">-</div>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][APort]" value="{{$value['Aport']}}" placeholder="降落机场" class="layui-input">
                                        </div>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][FlightFrom]" value="{{substr($value['FlightFrom'],2,4)}}" placeholder="起始航班号" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid">-</div>
                                        <div class="layui-input-inline">
                                            <input type="text" name="SaleFlightList[{{$key}}][FlightTo]" value="{{substr($value['FlightTo'],2,4)}}" placeholder="截止航班号" class="layui-input">
                                        </div>
                                        <div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-delete FlightSaleDelete"></i></div>
                                    </div>
                                @endif
                            @endforeach
                        @endif

                    @endif

                </div>
            </div>

            <!--去程-->
            <div class="layui-form-item">
                <span class="go-item"><label class="layui-form-label layui-required">航班日期</label></span><span class="back-item"><label class="layui-form-label layui-required">去程航班日期</label></span>
                <div class="layui-input-inline" id="flight-date" style="width: 500px;">
                    <div class="layui-input-inline layui-input-wrap">
                        <div class="layui-input-prefix">
                            <i class="layui-icon layui-icon-date"></i>
                        </div>
                        <input type="text" name="GoEffectDate" value="{{date('Y-m-d',substr($policy['FlightUnit']['GoFlight']['EffectDate'],6,10))}}" autocomplete="off" id="flight-start" lay-verify="required|title"  class="layui-input" placeholder="yyyy-MM-dd">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline layui-input-wrap">
                        <div class="layui-input-prefix">
                            <i class="layui-icon layui-icon-date"></i>
                        </div>
                        <input type="text" name="GoExpiryDate" value="{{date('Y-m-d',substr($policy['FlightUnit']['GoFlight']['ExpiryDate'],6,10))}}" autocomplete="off" id="flight-end" lay-verify="required|title"  class="layui-input" placeholder="yyyy-MM-dd">
                    </div>
                </div>
            </div>

            <div class="layui-form-item">
                <span class="go-item"><label class="layui-form-label">除外航班日期段</label></span><span class="back-item"><label class="layui-form-label">去程除外航班日期段</label></span>
                <div class="layui-input-inline" style="width: 405px">
                    <input type="text" name="GoExcludeRouteDate" value="{{$policy['FlightUnit']['GoFlight']['ExcludeRouteDate']}}" lay-verify="" lay-reqText=""  placeholder="例如：2030-06-01/2030-06-01,2030-10-01/2030-10-07" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">格式：YYYY-MM-DD/YYYY-MM-DD，多段中间用","隔开。</div>
            </div>

            <div class="layui-form-item">
                <span class="go-item"><label class="layui-form-label">起飞时间</label></span><span class="back-item"><label class="layui-form-label">去程起飞时间</label></span>
                <div class="layui-input-inline" style="width: 405px">
                    <input type="text" name="GoDepartTimeLimit" value="{{$policy['FlightUnit']['GoFlight']['DepartTimeLimit']}}" lay-verify="" lay-reqText=""  placeholder="格式：HHMM-HHMM,例如:0818-0918,至多3段，用,隔" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">格式：HHMM-HHMM，至多录入3段航班起飞时间，中间用","隔开。</div>
            </div>

            <div class="layui-form-item">
                <span class="go-item"><label class="layui-form-label layui-required">班期</label></span><span class="back-item"><label class="layui-form-label layui-required">去程班期</label></span>
                <div class="layui-input-inline" style="width: 500px">
                    <input type="checkbox" name="GoDays[]" value="1" title="周一" @if(strpos(' '.$policy['FlightUnit']['GoFlight']['Days'],'1')) checked @endif>
                    <input type="checkbox" name="GoDays[]" value="2" title="周二" @if(strpos(' '.$policy['FlightUnit']['GoFlight']['Days'],'2')) checked @endif>
                    <input type="checkbox" name="GoDays[]" value="3" title="周三" @if(strpos(' '.$policy['FlightUnit']['GoFlight']['Days'],'3')) checked @endif>
                    <input type="checkbox" name="GoDays[]" value="4" title="周四" @if(strpos(' '.$policy['FlightUnit']['GoFlight']['Days'],'4')) checked @endif>
                    <input type="checkbox" name="GoDays[]" value="5" title="周五" @if(strpos(' '.$policy['FlightUnit']['GoFlight']['Days'],'5')) checked @endif>
                    <input type="checkbox" name="GoDays[]" value="6" title="周六" @if(strpos(' '.$policy['FlightUnit']['GoFlight']['Days'],'6')) checked @endif>
                    <input type="checkbox" name="GoDays[]" value="7" title="周日" @if(strpos(' '.$policy['FlightUnit']['GoFlight']['Days'],'7')) checked @endif>
                </div>
                <div class="layui-form-mid" ><a href="#" id="flight-week-all" style="color: #1976d2" > 全选 </a>&nbsp;&nbsp;<a href="#" id="flight-week-invert" style="color: #1976d2">反选</a></div>
            </div>

            <!--返程-->
            <div class="back-item" style="border: 1px solid rgb(157, 157, 157); box-shadow: rgb(170, 170, 170) 0px 2px 6px; padding-top: 10px;">
                <div class="layui-form-item back-item">
                    <div class="layui-inline">
                        <label class="layui-form-label layui-required">返程航班</label>
                        <div class="layui-input-inline">
                            <a class="layui-btn flight" id="BackSaleFlightBtn">+ 添加可售范围</a><br>
                        </div>
                    </div>

                    <div class="layui-inline" id="BackFlightSale">
                        @if(!empty($policy['FlightUnit']['BackFlight']))
                            @if(!empty($policy['FlightUnit']['BackFlight']['SaleFlightList']))
                                @foreach($policy['FlightUnit']['BackFlight']['SaleFlightList'] as $key=>$value)
                                    @if($value['IsCanSale'] == 'T')
                                        <div class="layui-inline" >
                                            <input type="hidden" name="SaleFlightList[{{$key}}][IsCanSale]" value="{{$value['IsCanSale']}}" placeholder="" class="layui-input">
                                            <label class="layui-form-label"></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][DPort]" value="{{$value['DPort']}}" placeholder="起飞机场" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid">-</div>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][APort]" value="{{$value['Aport']}}" placeholder="降落机场" class="layui-input">
                                            </div>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][FlightFrom]" value="{{substr($value['FlightFrom'],2,4)}}" placeholder="起始航班号" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid">-</div>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][FlightTo]" value="{{substr($value['FlightTo'],2,4)}}" placeholder="截止航班号" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-delete FlightSaleDelete"></i></div>
                                        </div>
                                    @endif
                                @endforeach
                            @endif

                        @endif
                    </div>
                    <br>
                    <div class="layui-inline">
                        <label class="layui-form-label"></label>
                        <div class="layui-input-inline">
                            <a class="layui-btn flight" id="BackSaleLimitBtn">+ 添加禁售范围</a><br>
                        </div>
                    </div>
                    <div class="layui-inline" id="BackSaleLimit">
                        @if(!empty($policy['FlightUnit']['BackFlight']))
                            @if(!empty($policy['FlightUnit']['BackFlight']['SaleFlightList']))
                                @foreach($policy['FlightUnit']['BackFlight']['SaleFlightList'] as $key=>$value)
                                    @if($value['IsCanSale'] == 'F')
                                        <div class="layui-inline" >
                                            <input type="hidden" name="SaleFlightList[{{$key}}][IsCanSale]" value="{{$value['IsCanSale']}}" placeholder="" class="layui-input">
                                            <label class="layui-form-label"></label>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][DPort]" value="{{$value['DPort']}}" placeholder="起飞机场" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid">-</div>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][APort]" value="{{$value['Aport']}}" placeholder="降落机场" class="layui-input">
                                            </div>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][FlightFrom]" value="{{substr($value['FlightFrom'],2,4)}}" placeholder="起始航班号" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid">-</div>
                                            <div class="layui-input-inline">
                                                <input type="text" name="SaleFlightList[{{$key}}][FlightTo]" value="{{substr($value['FlightTo'],2,4)}}" placeholder="截止航班号" class="layui-input">
                                            </div>
                                            <div class="layui-form-mid layui-word-aux"><i class="layui-icon layui-icon-delete FlightSaleDelete"></i></div>
                                        </div>
                                    @endif
                                @endforeach
                            @endif
                        @endif
                    </div>
                </div>
                <div class="layui-form-item back-item">
                    <label class="layui-form-label layui-required">返程航班日期</label>
                    <div class="layui-input-inline" id="flight-date" style="width: 500px;">
                        <div class="layui-input-inline layui-input-wrap">
                            <div class="layui-input-prefix">
                                <i class="layui-icon layui-icon-date"></i>
                            </div>
                            <input type="text" name="BackEffectDate" value="{{date('Y-m-d',substr($policy['FlightUnit']['BackFlight']['EffectDate'],6,10))}}" autocomplete="off" id="flight-start-back" lay-verify="required|title"  class="layui-input" placeholder="yyyy-MM-dd">
                        </div>
                        <div class="layui-form-mid">-</div>
                        <div class="layui-input-inline layui-input-wrap">
                            <div class="layui-input-prefix">
                                <i class="layui-icon layui-icon-date"></i>
                            </div>
                            <input type="text" name="BackExpiryDate" value="{{date('Y-m-d',substr($policy['FlightUnit']['BackFlight']['ExpiryDate'],6,10))}}" autocomplete="off" id="flight-end-back" lay-verify="required|title"  class="layui-input" placeholder="yyyy-MM-dd">
                        </div>
                    </div>
                </div>

                <div class="layui-form-item back-item">
                    <label class="layui-form-label">返程除外航班日期段</label>
                    <div class="layui-input-inline" style="width: 405px">
                        <input type="text" name="BackExcludeRouteDate" value="{{!empty($policy['FlightUnit']['BackFlight']) && !empty($policy['FlightUnit']['BackFlight']['BackExcludeRouteDate']) ? $policy['FlightUnit']['BackFlight']['BackExcludeRouteDate'] : ''}}" lay-verify="" lay-reqText=""  placeholder="例如：2030-06-01/2030-06-01,2030-10-01/2030-10-07" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid">格式：YYYY-MM-DD/YYYY-MM-DD，多段中间用","隔开。</div>
                </div>

                <div class="layui-form-item back-item">
                    <label class="layui-form-label">返程起飞时间</label>
                    <div class="layui-input-inline" style="width: 405px">
                        <input type="text" name="BackDepartTimeLimit" value="{{!empty($policy['FlightUnit']['BackFlight']) && !empty($policy['FlightUnit']['BackFlight']['BackDepartTimeLimit']) ? $policy['FlightUnit']['BackFlight']['BackDepartTimeLimit'] : ''}}" lay-verify="" lay-reqText=""  placeholder="格式：HHMM-HHMM,例如:0818-0918,至多3段，用,隔" autocomplete="off" class="layui-input">
                    </div>
                </div>

                <div class="layui-form-item back-item">
                    <label class="layui-form-label layui-required">返程班期</label>
                    <div class="layui-input-inline" style="width: 500px">
                        <input type="checkbox" name="BackDays[]" value="1" title="周一" @if(strpos(' '.$policy['FlightUnit']['BackFlight']['Days'],'1')) checked @endif>
                        <input type="checkbox" name="BackDays[]" value="2" title="周二" @if(strpos(' '.$policy['FlightUnit']['BackFlight']['Days'],'2')) checked @endif>
                        <input type="checkbox" name="BackDays[]" value="3" title="周三" @if(strpos(' '.$policy['FlightUnit']['BackFlight']['Days'],'3')) checked @endif>
                        <input type="checkbox" name="BackDays[]" value="4" title="周四" @if(strpos(' '.$policy['FlightUnit']['BackFlight']['Days'],'4')) checked @endif>
                        <input type="checkbox" name="BackDays[]" value="5" title="周五" @if(strpos(' '.$policy['FlightUnit']['BackFlight']['Days'],'5')) checked @endif>
                        <input type="checkbox" name="BackDays[]" value="6" title="周六" @if(strpos(' '.$policy['FlightUnit']['BackFlight']['Days'],'6')) checked @endif>
                        <input type="checkbox" name="BackDays[]" value="7" title="周日" @if(strpos(' '.$policy['FlightUnit']['BackFlight']['Days'],'7')) checked @endif>
                    </div>
                    <div class="layui-form-mid" ><a href="#" id="flight-week-all-back" style="color: #1976d2" > 全选 </a>&nbsp;&nbsp;<a href="#" id="flight-week-invert-back" style="color: #1976d2">反选</a></div>
                </div>
            </div>
        </div>
        <hr>
        <div class="split-text">销售控制</div>
        <div class="piece">
            <div class="layui-form-item">
                <label class="layui-form-label layui-required">销售日期</label>
                <div class="layui-input-inline" id="sale-date" style="width: 500px;">
                    <div class="layui-input-inline layui-input-wrap">
                        <div class="layui-input-prefix">
                            <i class="layui-icon layui-icon-date"></i>
                        </div>
                        <input type="text" name="SaleEffectDate" value="{{date('Y-m-d',substr($policy['SaleLimitUnit']['EffectDate'],6,10))}}" autocomplete="off" id="sale-start"  lay-verify="required|title" class="layui-input" placeholder="yyyy-MM-dd">
                    </div>
                    <div class="layui-form-mid">-</div>
                    <div class="layui-input-inline  layui-input-wrap">
                        <div class="layui-input-prefix">
                            <i class="layui-icon layui-icon-date"></i>
                        </div>
                        <input type="text" name="SaleExpiryDate" value="{{date('Y-m-d',substr($policy['SaleLimitUnit']['ExpiryDate'],6,10))}}" autocomplete="off" id="sale-end"  lay-verify="required|title" class="layui-input" placeholder="yyyy-MM-dd">
                    </div>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label layui-required">销售周期</label>
                <div class="layui-input-inline" style="width: 500px">
                    <input type="checkbox" name="SaleDays[]" value="1" title="周一" @if(strpos(' '.$policy['SaleLimitUnit']['SaleDays'],'1')) checked @endif>
                    <input type="checkbox" name="SaleDays[]" value="2" title="周二" @if(strpos(' '.$policy['SaleLimitUnit']['SaleDays'],'2')) checked @endif>
                    <input type="checkbox" name="SaleDays[]" value="3" title="周三" @if(strpos(' '.$policy['SaleLimitUnit']['SaleDays'],'3')) checked @endif>
                    <input type="checkbox" name="SaleDays[]" value="4" title="周四" @if(strpos(' '.$policy['SaleLimitUnit']['SaleDays'],'4')) checked @endif>
                    <input type="checkbox" name="SaleDays[]" value="5" title="周五" @if(strpos(' '.$policy['SaleLimitUnit']['SaleDays'],'5')) checked @endif>
                    <input type="checkbox" name="SaleDays[]" value="6" title="周六" @if(strpos(' '.$policy['SaleLimitUnit']['SaleDays'],'6')) checked @endif>
                    <input type="checkbox" name="SaleDays[]" value="7" title="周日" @if(strpos(' '.$policy['SaleLimitUnit']['SaleDays'],'7')) checked @endif>
                </div>
                <div class="layui-form-mid" ><a href="#" id="sale-week-all" style="color: #1976d2" > 全选 </a>&nbsp;&nbsp;<a href="#" id="sale-week-invert" style="color: #1976d2">反选</a></div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">销售时间</label>
                <div class="layui-input-inline" style="width: 405px">
                    <input type="text" name="ControlTime" value="{{$policy['SaleLimitUnit']['ControlTime']}}" lay-verify="" lay-reqText="" placeholder="例如：0320-0524" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid" >格式：HHMM-HHMM，至多录入3段销售时间，中间用","隔开。</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">提前预订天数</label>
                <div class="layui-input-inline">
                    <input type="text" name="AdvanceDay" value="@if($policy['SaleLimitUnit']['MinAdvanceDays']) {{$policy['SaleLimitUnit']['MinAdvanceDays']}}-{{$policy['SaleLimitUnit']['MaxAdvanceDays']}} @endif" lay-verify="" lay-reqText="" placeholder="0-365" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid" >只能输入A-B的格式，并且A、B都是0到365之间的整数</div>
            </div>

            <div class="layui-form-item back-item">
                <label class="layui-form-label">停留天数(往返)</label>
                <div class="layui-input-inline">
                    <input type="text" name="StopDay" value="@if($policy['SaleLimitUnit']['MinStopDays']) {{$policy['SaleLimitUnit']['MinStopDays']}}-{{$policy['SaleLimitUnit']['MaxStopDays']}}  @endif" lay-verify="" lay-reqText="" placeholder="0-365" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid" >只能输入A-B的格式，并且A、B都是0到365之间的整数</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">儿童订成人票</label>
                <div class="layui-input-block">
                    <input type="radio" name="ApplyChild" value="T" title="可以" @if($policy['SaleLimitUnit']['ApplyChild'] == 'T') checked @endif>
                    <input type="radio" name="ApplyChild" value="F" title="不可以" @if($policy['SaleLimitUnit']['ApplyChild'] == 'F') checked @endif>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">定向投放</label>
                <div class="layui-input-inline" style="width: 400px">
                    <input type="checkbox" name="HideSales" value="" title="年龄限制" disabled>
                    <input type="checkbox" name="HideSales" value="T" title="乘客人数" lay-filter="HideSales">
                    <input type="checkbox" name="HideSales" value="PB-H" title="PB-H">
                </div>
            </div>

            <div id="passengers-num" style="border: 1px solid  #9d9d9d;display: none;box-shadow: 0 2px 6px #aaa;">

                <div class="layui-form-item" style="margin-top: 10px">
                    <label class="layui-form-label">乘客人数</label>
                    <div class="layui-input-inline">
                        <input type="text" name="passengersNum" value="2" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                    </div>
                    <div class="layui-form-mid" >可填写人数或范围.如果填2，表示只适用于两人同行;如果填2-3，表示只适用于2至3人同行，人数最少为2</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">婴儿是否计入人数</label>
                    <div class="layui-input-block">
                        <input type="radio" name="IncludeChildNum" value="T" title="可以" @if($policy['SaleLimitUnit']['IncludeChildNum'] == 'T') checked @endif>
                        <input type="radio" name="IncludeChildNum" value="F" title="不可以" @if($policy['SaleLimitUnit']['IncludeChildNum'] == 'F') checked @endif>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">同退改</label>
                    <div class="layui-input-block">
                        <input type="radio" name="RefundChange" value="A" title="无需同退改(不需要所有人同退同改)" @if($policy['SaleLimitUnit']['RefundChange'] == 'A') checked @endif>
                        <input type="radio" name="RefundChange" value="C" title="全部同退改(订单中所有人同退同改)" @if($policy['SaleLimitUnit']['RefundChange'] == 'C') checked @endif>
                    </div>
                </div>
            </div>

            <div class="layui-form-item" style="margin-bottom: 20px">
                <label class="layui-form-label">价格模型</label>
                <div class="layui-input-block">
                    <input type="radio" name="IsCompositionPrice" value="F" title="单人价格" lay-filter="IsCompositionPrice" @if($policy['SaleLimitUnit']['IsCompositionPrice'] == 'F') checked @endif>
                    <input type="radio" name="IsCompositionPrice" value="T" title="组合价格" lay-filter="IsCompositionPrice" @if($policy['SaleLimitUnit']['IsCompositionPrice'] == 'T') checked @endif>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">是否限制身份</label>
                <div class="layui-input-block">
                    <input type="radio" name="IDLimit" value="T" title="是" lay-filter="IDLimit">
                    <input type="radio" name="IDLimit" value="F" title="否" lay-filter="IDLimit" checked>
                </div>
            </div>

            <div class="layui-form-item" id="IDCardList" style="display: none;">
                <label class="layui-form-label">身份限制</label>
                <div class="layui-input-block">
                    <input type="checkbox" name="IDCardList[]" value="ID" title="身份证" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('ID',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                    <input type="checkbox" name="IDCardList[]" value="PASSPORT" title="护照" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('PASSPORT',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                    <input type="checkbox" name="IDCardList[]" value="MTC" title="军人证" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('MTC',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                    <input type="checkbox" name="IDCardList[]" value="RP" title="回乡证" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('RP',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                    <input type="checkbox" name="IDCardList[]" value="MTP" title="台胞证" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('MTP',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                    <input type="checkbox" name="IDCardList[]" value="HMP" title="港澳通行证" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('HMP',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                    <input type="checkbox" name="IDCardList[]" value="RBT" title="户口薄" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('RBT',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                    <input type="checkbox" name="IDCardList[]" value="BRC" title="出生证明" @if($policy['SaleLimitUnit']['IDLimitLimit'] && in_array('BRC',$policy['SaleLimitUnit']['IDLimitLimit'])) checked @endif>
                </div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">政策标签</label>
                <div class="layui-input-inline">
                    <input type="text" name="PNR" value="" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                </div>
                <div class="layui-form-mid">例如：M3S1, 表示买三赠一，乘客人数必须是4个，否则会校验失败; STU, 表示学生票</div>
            </div>

            <div class="layui-form-item">
                <label class="layui-form-label">电子行程单提供方式</label>
                <div class="layui-input-block">
                    <input type="radio" name="DZXC" value="T" title="TBK上传" lay-filter="">
                    <input type="radio" name="DZXC" value="F" title="携程开具" lay-filter="" checked>
                </div>
            </div>

        </div>
        <hr>

        <div class="split-text">运价信息</div>

        <div type="text/html" id="yun-jia" style="margin-top:50px;">

            @foreach($policy['RulePriceUnit']['RulePriceList'] as $key=>$value)

                <div class="piece" style="border: solid 1px #7da8c3;">

                    <div class="layui-form-item">
                        <label class="layui-form-label"><span class="layui-btn layui-btn-normal yun-jia-index" style="border-radius: 20px">第{{$key}}条运价信息</span></label>
                        <div class="layui-input-inline">
                            <a href="#" class="layui-btn flight yun-jia-delete" style="border: solid 1px;color: red; height: 30px; background:none;border-radius: 3px;margin: 12px 10px">删除信息</a>
                        </div>
                        <div class="layui-form-mid">最多50个字符,舱位之间用半角逗号分隔</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">舱位代码</label>
                        <div class="layui-input-inline">
                            <input type="text" name="RulePriceList[{{$key}}][SubClass]" value="{{$value['SubClass']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input SubClass">
                        </div>
                        <div class="layui-form-mid">最多50个字符,舱位之间用半角逗号分隔</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">退改签ID</label>
                        <div class="layui-input-inline">
                            <input type="text" name="RulePriceList[{{$key}}][RcID]" value="12410623" disabled lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input RcID">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">退改签选择</label>
                        <div class="layui-input-inline" style="width: 405px">
                            <input type="text" name="RulePriceList[{{$key}}][RcID_LIST]" value="12413045-372bd001-4091-d94d-73fa-3a135f650ca9" disabled lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input RcID_LIST">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">退改签格式</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{{$key}}][RuleRestrict][HasAssignEntry]" value="T" title="文字录入" @if($value['RuleRestrict']['HasAssignEntry'] == 'T') checked @endif>
                            <input type="radio" name="RulePriceList[{{$key}}][RuleRestrict][HasAssignEntry]" value="F" title="公式录入" @if($value['RuleRestrict']['HasAssignEntry'] == 'F') checked @endif>
                        </div>
                    </div>

                    <div id="rcId">
                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">计算基准</label>
                            <div class="layui-input-block">
                                <input type="radio" name="RulePriceList[{{$key}}][RuleRestrict][FeeBasis]" value="S" title="票面价" @if($value['RuleRestrict']['HasAssignEntry'] == 'S') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][RuleRestrict][FeeBasis]" value="F" title="标准价" @if($value['RuleRestrict']['HasAssignEntry'] == 'F') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][RuleRestrict][FeeBasis]" value="D" title="FD价" @if($value['RuleRestrict']['HasAssignEntry'] == 'D') checked @endif>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">退票公式</label>
                            <div class="layui-input-inline">
                                <input type="text" name="RulePriceList[{{$key}}][RuleRestrict][RefundRateRemarks]" value="{{$value['RuleRestrict']['RefundRateRemarks']}}" lay-verify="required|title" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            </div>
                            <div class="layui-form-mid">10-2-20-0-50，表示起飞前2小时之前的手续费比例是10%，起飞前2小时（含）以内收20%，航班起飞后收50%</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">最低退票费</label>
                            <div class="layui-input-inline">
                                <input type="text" name="RulePriceList[{{$key}}][RuleRestrict][MinFeeExpense]" value="{{$value['RuleRestrict']['MinFeeExpense']}}" lay-verify="required|title" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">改期公式</label>
                            <div class="layui-input-inline">
                                <input type="text" name="RulePriceList[{{$key}}][RuleRestrict][FreeChangeTimeRemarks]" value="{{$value['RuleRestrict']['FreeChangeTimeRemarks'] ? : 0}}" lay-verify="required|title" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">是否签转</label>
                            <div class="layui-input-block">
                                <input type="radio" name="RulePriceList[{{$key}}][RuleRestrict][IsEndorse]" value="T" title="是" @if($value['RuleRestrict']['IsEndorse'] == 'T') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][RuleRestrict][IsEndorse]" value="F" title="否" @if($value['RuleRestrict']['IsEndorse'] == 'F') checked @endif>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">退改签备注</label>
                            <div class="layui-input-inline" style="width: 405px;">
                                <textarea name="RulePriceList[{{$key}}][RuleRestrict][Remarks]" class="layui-textarea">{{$value['RuleRestrict']['Remarks']}}</textarea>
                            </div>
                        </div>
                    </div>

                    <div id="rcId">
                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">计算基准</label>
                            <div class="layui-input-block">
                                <input type="radio" name="RulePriceList[{{$key}}][ClassForbidden]" value="T" title="是" @if($value['ClassForbidden'] == 'T') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][ClassForbidden]" value="F" title="否" @if($value['ClassForbidden'] == 'F') checked @endif>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">票面价算法</label>
                            <div class="layui-input-inline">
                                <select name="RulePriceList[{{$key}}][PriceRule]">
                                    <option value="0">无</option>
                                    <option value="1" @if($value['PriceRule'] == 1) selected @endif>票面价减比</option>
                                    <option value="2" @if($value['PriceRule'] == 2) selected @endif>标准价减比</option>
                                    <option value="3" @if($value['PriceRule'] == 3) selected @endif>票面价减Y舱比</option>
                                    <option value="4" @if($value['PriceRule'] == 4) selected @endif>直减金额</option>
                                    <option value="5" @if($value['PriceRule'] == 5) selected @endif>票面价原价</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">票面价进位规则</label>
                            <div class="layui-input-block">
                                <input type="radio" name="RulePriceList[{{$key}}][NumCarryRule]" value="Tens" title="进到十位" @if($value['NumCarryRule'] == 'Tens') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][NumCarryRule]" value="RoundTens" title="四舍五入到十位" @if($value['NumCarryRule'] == 'RoundTens') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][NumCarryRule]" value="RoundUnit" title="四舍五入到个位" @if($value['NumCarryRule'] == 'RoundUnit') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][NumCarryRule]" value="3" title="三舍四入到个位" checked>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">下浮比例</label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][DownwardRate]" value="{{$value['DownwardRate']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    %
                                </div>
                            </div>
                            <div class="layui-form-mid">保留一位小数[0-100)，可以输入0</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">直减金额</label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][SubtractPrice]" value="{{$value['SubtractPrice']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    元
                                </div>
                            </div>
                            <div class="layui-form-mid">保留整数，可以输入0</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">售卖价格范围</label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][PrintPriceRange]" value="{{$value['PrintPriceRange']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    元
                                </div>
                            </div>
                            <div class="layui-form-mid">正整数,可录入多段,英文逗号分隔,如100-200,300-400,限制录入段数为3段</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">票面价可信</label>
                            <div class="layui-input-block">
                                <input type="radio" name="piaomianjia" value="T" title="是" checked>
                                <input type="radio" name="piaomianjia" value="F" title="否">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">建议销售价算法</label>
                            <div class="layui-input-inline">
                                <select name="RulePriceList[{{$key}}][SalePriceRule]">
                                    <option value="PriceRuleZeroEnum" @if($value['SalePriceRule'] == 'PriceRuleZeroEnum') selected @endif>无建议销售价</option>
                                    <option value="TicketPricePercent" @if($value['SalePriceRule'] == 'TicketPricePercent') selected @endif>票面价减比</option>
                                    <option value="StandardPricePercent" @if($value['SalePriceRule'] == 'StandardPricePercent') selected @endif>标准价减比</option>
                                    <option value="TicketPriceMinusYclassPercent" @if($value['SalePriceRule'] == 'TicketPriceMinusYclassPercent') selected @endif>票面价减Y舱比</option>
                                    <option value="DirectMinusValue" @if($value['SalePriceRule'] == 'DirectMinusValue') selected @endif>直减金额</option>
                                    <option value="TicketActualPrice" @if($value['SalePriceRule'] == 'TicketActualPrice') selected @endif>票面价原价</option>
                                </select>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">代理费率</label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][Commision]" value="{{$value['Commision']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    %
                                </div>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">留钱</label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][ReturnPrice]" value="{{$value['ReturnPrice']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    元
                                </div>
                            </div>
                            <div class="layui-form-mid">正负整数</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">后返扣率</label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][AfterwardsReturnRate]" value="{{$value['AfterwardsReturnRate']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    %
                                </div>
                            </div>
                            <div class="layui-form-mid">和后返固定金额不可同时填写，保留两位小数,范围[0,100),可以输入0</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">后返固定金额</label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][AfterwardsReturnPrice]" value="{{$value['AfterwardsReturnPrice']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    元
                                </div>
                            </div>
                            <div class="layui-form-mid">正负整数</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">竞价类型</label>
                            <div class="layui-input-block">
                                <input type="radio" name="RulePriceList[{{$key}}][BidType]" value="0" title="按固定金额" lay-filter="BidType" @if($value['BidType'] == 0) checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][BidType]" value="1" title="按百分比" lay-filter="BidType" @if($value['BidType'] == 1) checked @endif>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="BiddingSpace_Money"><label class="layui-form-label">竞价金额</label></label><label class="BiddingSpace_Percentage" style="display: none;"><label class="layui-form-label">百分比</label></label>
                            <div class="layui-input-inline layui-input-group">
                                <input type="text" name="RulePriceList[{{$key}}][BiddingSpace]" value="{{$value['BiddingSpace']}}" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                                <div class="layui-input-split layui-input-suffix">
                                    <label class="BiddingSpace_Money">元</label><label class="BiddingSpace_Percentage" style="display: none;">%</label>
                                </div>
                            </div>
                            <div class="layui-form-mid">不允许录入负值支持2位小数；非旅行套餐范围为[0,100]，旅行套餐范围[0,300]；不填默认0</div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label layui-required">库存类型</label>
                            <div class="layui-input-block">
                                <input type="radio" name="RulePriceList[{{$key}}][InventoryType]" value="FIX" title="按照库存销售" lay-filter="InventoryType" @if($value['InventoryType'] == 'FIX') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][InventoryType]" value="FAV" title="在Eterm舱位外放时设置最大销售数量" lay-filter="InventoryType"  @if($value['InventoryType'] == 'FAV') checked @endif>
                            </div>
                        </div>

                        <div class="layui-form-item IsReturnRefundInventory" style="display: none;">
                            <label class="layui-form-label">退票是否还库存</label>
                            <div class="layui-input-block">
                                <input type="radio" name="RulePriceList[{{$key}}][IsReturnRefundInventory]" value="T" title="是" @if($value['IsReturnRefundInventory'] == 'T') checked @endif>
                                <input type="radio" name="RulePriceList[{{$key}}][IsReturnRefundInventory]" value="F" title="否" @if($value['IsReturnRefundInventory'] == 'F') checked @endif>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">库存数量</label>
                            <div class="layui-input-inline">
                                <input type="text" name="RulePriceList[{{$key}}][Inventory]" value="{{$value['Inventory']}}" id="TicketInventory" lay-verify="" lay-reqText="" lay-filter="TicketInventory" placeholder="" autocomplete="off" class="layui-input TicketInventory">
                            </div>
                            <div class="layui-form-mid">如不填写，则按照Eterm舱位外放情况销售</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">剩余可售数量</label>
                            <div class="layui-input-inline">
                                <input type="text" name="RulePriceList[{{$key}}][LeftInventory]" value="{{$value['LeftInventory']}}" lay-verify="" lay-reqText="" disabled placeholder="" autocomplete="off" class="layui-input input-bottom" >
                            </div>
                        </div>
                    </div>
                </div>

            @endforeach

        </div>

        <script type="text/template" id="yun-jia-html">

            <div class="piece" style="border: solid 1px #7da8c3;">

                <div class="layui-form-item">
                    <label class="layui-form-label"><span class="layui-btn layui-btn-normal yun-jia-index" style="border-radius: 20px">第{piece}条运价信息</span></label>
                    <div class="layui-input-inline">
                        <a href="#" class="layui-btn flight yun-jia-delete" style="border: solid 1px;color: red; height: 30px; background:none;border-radius: 3px;margin: 12px 10px">删除信息</a>
                    </div>
                    <div class="layui-form-mid">最多50个字符,舱位之间用半角逗号分隔</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">舱位代码</label>
                    <div class="layui-input-inline">
                        <input type="text" name="RulePriceList[{piece}][SubClass]" value="" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input SubClass">
                    </div>
                    <div class="layui-form-mid">最多50个字符,舱位之间用半角逗号分隔</div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">退改签ID</label>
                    <div class="layui-input-inline">
                        <input type="text" name="RulePriceList[{piece}][RcID]" value="12410623" disabled lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input RcID">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">退改签选择</label>
                    <div class="layui-input-inline" style="width: 405px">
                        <input type="text" name="RulePriceList[{piece}][RcID_LIST]" value="12413045-372bd001-4091-d94d-73fa-3a135f650ca9" disabled lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input RcID_LIST">
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label layui-required">退改签格式</label>
                    <div class="layui-input-block">
                        <input type="radio" name="RulePriceList[{piece}][HasAssignEntry]" value="T" title="文字录入" checked>
                        <input type="radio" name="RulePriceList[{piece}][HasAssignEntry]" value="F" title="公式录入">
                    </div>
                </div>

                <div id="rcId">
                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">计算基准</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{piece}][FeeBasis]" value="S" title="票面价" checked>
                            <input type="radio" name="RulePriceList[{piece}][FeeBasis]" value="F" title="标准价">
                            <input type="radio" name="RulePriceList[{piece}][FeeBasis]" value="D" title="FD价">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">退票公式</label>
                        <div class="layui-input-inline">
                            <input type="text" name="RulePriceList[{piece}][RefundRateRemarks]" value="0" lay-verify="required|title" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                        <div class="layui-form-mid">10-2-20-0-50，表示起飞前2小时之前的手续费比例是10%，起飞前2小时（含）以内收20%，航班起飞后收50%</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">最低退票费</label>
                        <div class="layui-input-inline">
                            <input type="text" name="RulePriceList[{piece}][MinFeeExpense]" value="0" lay-verify="required|title" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">改期公式</label>
                        <div class="layui-input-inline">
                            <input type="text" name="RulePriceList[{piece}][FreeChangeTimeRemarks]" value="0" lay-verify="required|title" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">是否签转</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{piece}][IsEndorse]" value="T" title="是" checked>
                            <input type="radio" name="RulePriceList[{piece}][IsEndorse]" value="F" title="否">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">退改签备注</label>
                        <div class="layui-input-inline" style="width: 405px;">
                            <textarea name="RulePriceList[{piece}][Remarks]" class="layui-textarea">不退不改不签</textarea>
                        </div>
                    </div>
                </div>

                <div id="rcId">
                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">计算基准</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{piece}][ClassForbidden]" value="T" title="是" checked>
                            <input type="radio" name="RulePriceList[{piece}][ClassForbidden]" value="F" title="否">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">票面价算法</label>
                        <div class="layui-input-inline">
                            <select name="RulePriceList[{piece}][PriceRule]">
                                <option value="0">无</option>
                                <option value="1">票面价减比</option>
                                <option value="2">标准价减比</option>
                                <option value="3">票面价减Y舱比</option>
                                <option value="4">直减金额</option>
                                <option value="5">票面价原价</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">票面价进位规则</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{piece}][NumCarryRule]" value="0" title="进到十位" checked>
                            <input type="radio" name="RulePriceList[{piece}][NumCarryRule]" value="1" title="四舍五入到十位" checked>
                            <input type="radio" name="RulePriceList[{piece}][NumCarryRule]" value="2" title="四舍五入到个位" checked>
                            <input type="radio" name="RulePriceList[{piece}][NumCarryRule]" value="3" title="三舍四入到个位" checked>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">下浮比例</label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][DownwardRate]" value="0" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                %
                            </div>
                        </div>
                        <div class="layui-form-mid">保留一位小数[0-100)，可以输入0</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">直减金额</label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][SubtractPrice]" value="" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                元
                            </div>
                        </div>
                        <div class="layui-form-mid">保留整数，可以输入0</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">售卖价格范围</label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][PrintPriceRange]" value="" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                元
                            </div>
                        </div>
                        <div class="layui-form-mid">正整数,可录入多段,英文逗号分隔,如100-200,300-400,限制录入段数为3段</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">票面价可信</label>
                        <div class="layui-input-block">
                            <input type="radio" name="piaomianjia" value="T" title="是" checked>
                            <input type="radio" name="piaomianjia" value="F" title="否">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">建议销售价算法</label>
                        <div class="layui-input-inline">
                            <select name="RulePriceList[{piece}][SalePriceRule]">
                                <option value="0">无建议销售价</option>
                                <option value="1">票面价减比</option>
                                <option value="2">标准价减比</option>
                                <option value="3">票面价减Y舱比</option>
                                <option value="4">直减金额</option>
                                <option value="5">票面价原价</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">代理费率</label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][Commision]" value="0" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                %
                            </div>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">留钱</label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][ReturnPrice]" value="0" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                元
                            </div>
                        </div>
                        <div class="layui-form-mid">正负整数</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">后返扣率</label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][AfterwardsReturnRate]" value="0" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                %
                            </div>
                        </div>
                        <div class="layui-form-mid">和后返固定金额不可同时填写，保留两位小数,范围[0,100),可以输入0</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">后返固定金额</label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][AfterwardsReturnPrice]" value="0" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                元
                            </div>
                        </div>
                        <div class="layui-form-mid">正负整数</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">竞价类型</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{piece}][BidType]" value="0" title="按固定金额" checked lay-filter="BidType">
                            <input type="radio" name="RulePriceList[{piece}][BidType]" value="1" title="按百分比" lay-filter="BidType">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="BiddingSpace_Money"><label class="layui-form-label">竞价金额</label></label><label class="BiddingSpace_Percentage" style="display: none;"><label class="layui-form-label">百分比</label></label>
                        <div class="layui-input-inline layui-input-group">
                            <input type="text" name="RulePriceList[{piece}][BiddingSpace]" value="0" lay-verify="" lay-reqText="" placeholder="" autocomplete="off" class="layui-input">
                            <div class="layui-input-split layui-input-suffix">
                                <label class="BiddingSpace_Money">元</label><label class="BiddingSpace_Percentage" style="display: none;">%</label>
                            </div>
                        </div>
                        <div class="layui-form-mid">不允许录入负值支持2位小数；非旅行套餐范围为[0,100]，旅行套餐范围[0,300]；不填默认0</div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label layui-required">库存类型</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{piece}][InventoryType]" value="FIX" title="按照库存销售" lay-filter="InventoryType">
                            <input type="radio" name="RulePriceList[{piece}][InventoryType]" value="FAV" title="在Eterm舱位外放时设置最大销售数量" lay-filter="InventoryType" checked>
                        </div>
                    </div>

                    <div class="layui-form-item IsReturnRefundInventory" style="display: none;">
                        <label class="layui-form-label">退票是否还库存</label>
                        <div class="layui-input-block">
                            <input type="radio" name="RulePriceList[{piece}][IsReturnRefundInventory]" value="T" title="是">
                            <input type="radio" name="RulePriceList[{piece}][IsReturnRefundInventory]" value="F" title="否" checked>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label class="layui-form-label">库存数量</label>
                        <div class="layui-input-inline">
                            <input type="text" name="RulePriceList[{piece}][Inventory]" value="" id="TicketInventory" lay-verify="" lay-reqText="" lay-filter="TicketInventory" placeholder="" autocomplete="off" class="layui-input TicketInventory">
                        </div>
                        <div class="layui-form-mid">如不填写，则按照Eterm舱位外放情况销售</div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">剩余可售数量</label>
                        <div class="layui-input-inline">
                            <input type="text" name="RulePriceList[{piece}][LeftInventory]" value="" lay-verify="" lay-reqText="" disabled placeholder="" autocomplete="off" class="layui-input input-bottom" >
                        </div>
                    </div>
                </div>
            </div>
        </script>
        <div class="layui-form-item">
            <label class="layui-form-label"><a class="layui-btn flight" id="yun-jia-add" href="#">新增运价信息</a></label>
            <div class="layui-input-inline">
            </div>
        </div>
        <hr>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="*">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>

@endsection

@push('script')
    <script src="/static/js/rulepolicy/ctrip.js"></script>
    <script>
        layui.use(['form'], function() {

            var $ = layui.$
                ,form = layui.form;

            //监听提交
            form.on('submit(*)', function(data){

                $.ajax({
                    url: '/rulepolicy/ajaxUpdate'
                    , method: 'put'
                    , data: data.field
                    , dataType: 'json'
                    , success: function (data) {

                        layer.msg(data.errmsg, {
                            offset: '15px'
                            ,icon: (data.errcode == 0 ? 1: 5)
                            ,time: 5000
                        }, function(){});
                    },
                });

                return false;
            });

        })
    </script>
@endpush